from commons.common import getLastDateTime
from files.report_xlsx import ReportXlsx
from windows import SN, test_fail_id, test_result_var, report_data
from bases.windows import test_time_var


def add_report_data():
    '''
    SN，日期时间，测试时间，测试结果，测试失败项，Main测试实际值
    :return:
    '''
    sn = SN.get()                               # SN
    date = getLastDateTime()                    # 日期时间
    test_time = test_time_var.get()             # 测试时间
    test_result = test_result_var.get()         # 测试结果
    fail_id = test_fail_id.get()                # 测试失败项
    l = [sn,date,test_time,test_result,fail_id]
    l.extend(report_data)
    print(report_data)
    # 写入报告
    try:
        ReportXlsx.report_write_data(l)
        return "True"
    except Exception as e:
        return "False"